//
//  UILabel+LXAdd.h
//  LXLabelDemo
//
//  Created by 刘鑫 on 16/4/13.
//  Copyright © 2016年 liuxin. All rights reserved.
//

#import <UIKit/UIKit.h>
/** 
 用法实例:
 
     // Do any additional setup after loading the view, typically from a nib.
     lab=[[UILabel alloc] init];
     lab.text=@"一款简单的UILabel。支持修改字间距，行间距，设置关键字，下划线，自动计算宽高并返回";
     //lab.backgroundColor=[UIColor lightGrayColor];
     lab.numberOfLines=8;
     lab.font=[UIFont systemFontOfSize:15];
     lab.textAlignment=NSTextAlignmentLeft;
     
     lab.characterSpace=3;//字间距
     lab.lineSpace=5;//行间距
     //关键字
     lab.keywords=@"关键字";
     lab.keywordsColor=[UIColor redColor];
     lab.keywordsFont=[UIFont systemFontOfSize:20];
     //下划线
     lab.underlineStr=@"下划线";
     lab.underlineColor=[UIColor redColor];
     //计算label的宽高
     CGSize labSize =  [lab getLableSizeWithMaxWidth:self.view.bounds.size.width];
     lab.frame=CGRectMake(0, 100, labSize.width, labSize.height);
     
     [self.view addSubview:lab];
 
 */

@interface UILabel (LXAdd)
/**
 *  字间距
 */
@property (nonatomic,assign)CGFloat characterSpace;

/**
 *  行间距
 */
@property (nonatomic,assign)CGFloat lineSpace;

/**
 *  关键字
 */
/** 关键字数组 */
@property (nonatomic, copy) NSArray *keywordsArray;
@property (nonatomic,copy)NSString *keywords;
@property (nonatomic,strong)UIFont *keywordsFont;
@property (nonatomic,strong)UIColor *keywordsColor;

/**
 *  下划线
 */
@property (nonatomic,copy)NSString *underlineStr;
@property (nonatomic,strong)UIColor *underlineColor;

/**
 *  计算label宽高，必须调用
 *
 *  @param maxWidth 最大宽度
 *
 *  @return label的size
 */
- (CGSize)getLableSizeWithMaxWidth:(CGFloat)maxWidth;
@end


@interface NSString (LabelHeigth)


/**
 获取label高度
 font: label的字体大小
 labelWidth: label的宽度
 labelNumberOfLines: label的行数
 labelLineSpace: label文字的行距
 characterSpace: label文字的字间距
 */
- (CGFloat)getLabelSizeWithLabelFont:(UIFont *)font
                          labelWidth:(CGFloat)labelWidth
                  labelNumberOfLines:(NSInteger)labelNumberOfLines
                      labelLineSpace:(CGFloat)labelLineSpace
                 labelCharacterSpace:(CGFloat)characterSpace;

- (CGSize)zj_getLabelSizeWithLabelFont:(UIFont *)font
                            labelWidth:(CGFloat)labelWidth
                    labelNumberOfLines:(NSInteger)labelNumberOfLines
                        labelLineSpace:(CGFloat)labelLineSpace
                   labelCharacterSpace:(CGFloat)characterSpace;

@end



